<?php
/*
$JA#COPYRIGHT$
*/

// no direct access
defined('_JEXEC') or die('Restricted access');
require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');

class modLatestResumesHelper
{
	function getList($model, &$params)
	{
		
		global $mainframe;
		$limitstart = 0;
		$db			=& JFactory::getDBO();
		
		$count		= (int) $params->get('count', 5);
		
		// Content Items only
		$Itemid = JRequest::getVar('Itemid');
		$where_more = '';
		$where_more .= ' and a.published=1';
        $where_more .= ' and a.approved=1';
        $where_more .= " and rs.block=0";
		$rows = $model->getItems($where_more,$count,$limitstart,true);

		$i		= 0;
		$lists	= array();
		if (is_array($rows))
		foreach ( $rows as $row )
		{
			$user = JFactory::getUser($row->user_id_tmp);
			$username = $user->username;
			$username = str_replace('.', '()', $username);
			$lists[$i]->link = JRoute::_('index.php?option=com_jajobboard&view=jaresumes&layout=jaview&cid[]='.$username.'&Itemid=1000');

			$lists[$i]->text = htmlspecialchars( $row->title );
			$lists[$i]->name = htmlspecialchars( $row->user_id );
			$lists[$i]->image = $row->image;	
			$i++;
			if ($i>$count)
				break;
		}

		return $lists;		
	}
	
}
